/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.vs.kindlecoll.UI;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 *
 * @author volodymyr.sadovyy
 */
class PopupMenuListener extends MouseAdapter {
    @Override
    public void mousePressed(MouseEvent e){
        if (e.isPopupTrigger())
            showMenu(e);
    }

    @Override
    public void mouseReleased(MouseEvent e){
        if (e.isPopupTrigger())
            showMenu(e);
    }

    private void showMenu(MouseEvent e){
        PopupMenu menu = new PopupMenu();
        menu.show(e.getComponent(), e.getX(), e.getY());
    }
}